package br.com.salao.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="endereco")
public class Endereco implements Serializable  {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	private static final long serialVersionUID = 1L;

	@Column(length=100)
	private String logradouro;
	@Column(length=10)
	private String numero;
	
	@ManyToOne
	@JoinColumn(name = "id_bairro", nullable = false)
	private Bairro bairro;
	@Column(length=10)
	private String cep;
	
	@Temporal(TemporalType.DATE)
	private Date created = new Date();
	
	private boolean isEstabelecimento = false;
	
	public Endereco(){
		bairro = new Bairro();
	}
	
	//Gets e Sets

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getLogradouro() {
		return logradouro;
	}

	public void setLogradouro(String logradouro) {
		this.logradouro = logradouro;
	}

	public String getNumero() {
		return numero;
	}

	public void setNumero(String numero) {
		this.numero = numero;
	}

	public Bairro getBairro() {
		return bairro;
	}

	public void setBairro(Bairro bairro) {
		this.bairro = bairro;
	}

	public String getCep() {
		return cep;
	}

	public void setCep(String cep) {
		this.cep = cep;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public boolean isEstabelecimento() {
		return isEstabelecimento;
	}

	public void setEstabelecimento(boolean isEstabelecimento) {
		this.isEstabelecimento = isEstabelecimento;
	}	
	
}
